import request from '@/utils/processRequest';

export function commonTablePost(data, url) {
  return request({
    url: url,
    method: 'post',
    data
  });
}
export function handleNodeFreeSelectUser(data) {
  return request({
    url: '/formTask/task/handleNodeFreeSelectUser',
    method: 'post',
    data
  });
}
export function doAction(data) {
  return request({
    url: '/formTask/doAction',
    method: 'post',
    data
  });
}
export function flowImage(params) {
  return request({
    url: '/formTask/instance/flowImage',
    method: 'get',
    params,
    responseType: 'blob'
  });
}
export function getInstanceOpinion(params) {
  return request({
    url: '/formTask/instance/getInstanceOpinion',
    method: 'get',
    params
  });
}
export function getCanBackHistoryNodes(data) {
  return request({
    url: '/formTask/task/getCanBackHistoryNodes',
    method: 'post',
    data
  });
}

// 根据菜单查询主表表头信息以及子表基础信息
export function getDataSoure(params) {
  return request({
    url: '/dynamicForm/queryParentHeader',
    method: 'get',
    params
  });
}

// 查询表头列表
export function getTableHeader(params) {
  return request({
    url: '/dynamicHeader/findTableHeader',
    method: 'get',
    params
  });
}
// 根据用户Id和表Id获取个性化表头列表
export function getByUserAndTableId(data) {
  return request({
    url: '/header/personal/getByUserAndTableId',
    method: 'post',
    data
  });
}
// 个性化表头绑定或解绑
export function bindOrNot(data) {
  return request({
    url: '/header/personal/bindOrNot',
    method: 'post',
    data
  });
}
// 删除表单
export function delTable(data) {
  return request({
    url: '/dynamicForm/delete',
    method: 'post',
    data
  });
}

// 下载报表
export function downloadTable(data) {
  return request({
    url: '/excel/export',
    method: 'post',
    data,
    responseType: 'blob'
  });
}

export function findPrintConfigByTableId(params) {
  return request({
    url: '/tableDownload/findByTableId',
    method: 'get',
    params
  });
}
// 导出报表
export function getupload(data) {
  return request({
    url: '/excel/upload',
    method: 'post',
    data,
    headers: {
      'Content-Type': 'multipart/form-data'
    }
  });
}

// 导出报表
export function delmoreTable(data) {
  return request({
    url: '/dynamicForm/batchDelete',
    method: 'post',
    data
  });
}

// 获取公告公示
export function getNotice(data) {
  return request({
    url: '/notice/get',
    method: 'post',
    data
  });
}

// 添加公告公示
export function addNotice(data) {
  return request({
    url: '/notice/add',
    method: 'post',
    data
  });
}

// 下载WORD
export function downLoadNotice(data) {
  return request({
    url: '/notice/downLoad',
    method: 'post',
    data,
    responseType: 'blob'
  });
}

